package at.ac.tuwien.isis.infret.ue3.testing;

import static org.junit.Assert.*;

import java.io.File;
import java.util.Arrays;
import java.util.Vector;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import at.ac.tuwien.isis.infret.ue3.GlobalQueryHandler;
import at.ac.tuwien.isis.infret.ue3.QueryHandler;

public class QueryHandlerTest {
	QueryHandler test;
	@Before
	public void setUp() throws Exception {
		test = new QueryHandler(
				"res"+File.separatorChar+
				"testing"+File.separatorChar+
				"testing.rh.arff");
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testGetDistanceMatrix() {
		Double[][] distanceMatrix = test.computeDistanceMatrix(); 
		Double[][] distanceMatrix2 = test.computeDistanceMatrix(); 
		for(int i = 0; i < distanceMatrix.length;i++){
			for(int j = 0; j < distanceMatrix.length; j++){
				System.out.print(distanceMatrix[i][j]+" ");
				distanceMatrix2[j][i] +=distanceMatrix[i][j];
			}
			System.out.print("\n");
		}
		Vector<Double[][]> wrapper = new Vector<Double[][]>();
		wrapper.add(distanceMatrix);
		wrapper.add(distanceMatrix2);
		GlobalQueryHandler test2 =new GlobalQueryHandler(wrapper);
		wrapper = test2.getRankMatrices();
		
		Double[][] output = test2.getMergedRankMatrix(wrapper);
			for(int i = 0; i < output.length;i++){
				for(int j = 0; j < output.length; j++){
					System.out.print(output[i][j]+" ");
				}
				System.out.print("\n");
			}
		
		//fail("Not yet implemented");
	}

}
